import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-03-27
 * Time: 09:44
 */
public class Solution {
    public void moveZeroes(int[] nums) {
        int desc = -1;
        int cur = 0;
        while(cur < nums.length){
            if(nums[cur] != 0){
                desc++;
                swap(desc,cur,nums);
            }
            cur++;
        }
    }
    public void swap(int x,int y,int[] nums){
        int temp = nums[x];
        nums[x] = nums[y];
        nums[y] = temp;
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] nums = {0, 1, 0, 3, 12};
        solution.moveZeroes(nums);
        System.out.println(Arrays.toString(nums));
    }
}